<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css"></link>

<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="/js/jquery.leanModal.min.js"></script>
<link type="text/css" href="/css/start/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
<link rel="stylesheet" href="/js/chosen/chosen.css" />
<script type="text/javascript" language="javascript" >
jQuery.fn.dataTableExt.oApi.fnGetHiddenNodes = function ( settings )
{
    var nodes;
    var display = jQuery('tbody tr', settings.nTable);
 
    if ( jQuery.fn.dataTable.versionCheck ) {
        // DataTables 1.10
        var api = new jQuery.fn.dataTable.Api( settings );
        nodes = api.rows().nodes().toArray();
    }
    else {
        // 1.9-
        nodes = this.oApi._fnGetTrNodes( settings );
    }
 
    /* Remove nodes which are being displayed */
    for ( var i=0 ; i<display.length ; i++ ) {
        var iIndex = jQuery.inArray( display[i], nodes );
 
        if ( iIndex != -1 ) {
            nodes.splice( iIndex, 1 );
        }
    }
 
    return nodes;
};

$(document).ready(function() {
   oTable = $('#product_table').dataTable();
    
   $('form').submit(function(){
      $(oTable.fnGetHiddenNodes()).find('input:hidden').appendTo(this);
   });
} );
	</script>
</head>
<body>
<div style="font-family:Arial, Helvetica, sans-serif;" >
<h1>Log Record:</h1>
<?php $stDetail = new Model_DbTable_Roster_Stafflogindetail();
  	  $st = new Model_DbTable_Roster_Staffinfo();
  	  $stList = $stDetail->listAllActiveStaff();?>
<form id="form1" name="form1" method="post" action="" enctype="multipart/form-data">
<table border="1" cellspacing="0" cellpadding="5">
	<tr>
		<th colspan="2" scope="col">Add Record</th>
	</tr>
	<tr>
		<td>Staff</td>
		<td><input name = "staff" id = "staff" type="text" size = "45px"></input></td>
	</tr>
	<tr>
		<td>Type</td>
		<td><select id = 'type' name = 'type' style = "width:100%">
  				<option value="New Feature">New Feature</option>
  				<option value="Improvement">Improvement</option>
  				<option value="Bug Fix">Bug Fix</option>
  				<option value="Tutorial">Tutorial</option>
  				<option value="Software">Software</option>
                <option value="Hardware">Hardware</option>
  				<option value="RemoteHelp">Remote Help</option>
			</select></td>
	</tr>
	<tr>
		<td>Sub Type</td>	
		<td><input name = "sub_type" id = "sub_type" type="text" size = "45px"></input></td>
	</tr>
	<tr>
		<td>Detail</td>	
		<td><textarea name = "detail" id = "detail" style = "width:300px;height:80px;padding:5px;"></textarea></td>
	</tr>
	<tr>
		<td>Link</td>	
		<td><input name = "link" id = "link" type="text" size = "45px"></input></td>
	</tr>
	<tr>
		<td>Status</td>
		<td><select name = "status">
			<option value = "CODE">Coding</option>
			<option value = "WAIT">Waiting feedback</option>
			<option value = "COMPLETE">Completed</option>
		</select></td>
	</tr>
	<tr>
		<td>For Who</td>
		<td><select name="receiver" data-placeholder="Please Choose" class="chzn-select" style="width:200px" >
		
		
     <option value=""></option>
      <?php foreach($stList as $k3 => $v3) {
      $stf = $st->getStaffinfo($v3['id']);
      	
      	?>
      <option value="<?=$v3["id"]?>">
        <?=ucwords($v3["ni"])?>
        .
        <?=chr($v3["il"]+64)?> ( <?=ucwords(Model_EncryptHelper::getSslPassword($v3["n"]))?> )
        </option>
      <?php }?>
      
    </select>
		
		</td>
	</tr>
	<tr>
		<td colspan="2" scope="col"><input name="submit" id = "submit" type = "submit" value = "Add Log"></input></td>
	</tr>
	

</table>
<br />
<table width="1100" border="1" cellspacing="0" cellpadding="10" style="font-size:13px;" id="product_table">
<thead> 
  <tr>
    <th scope="col">ID</th>
    <th scope="col">Type</th>
    <th scope="col">Sub Type</th>
    <th scope="col">Link</th>
    <th scope="col">Detail</th>
    <th scope="col">Staff</th>
    <th scope="col">Date</th>
    <th scope="col">Receiver</th>
    <th scope="col">FeedBack</th>
    <th scope="col">FB Date</th>
  </tr>
 </thead> 
 <tfoot> 
  <tr>
    <th scope="col">ID</th>
    <th scope="col">Type</th>
    <th scope="col">Sub Type</th>
    <th scope="col">Link</th>
    <th scope="col">Detail</th>
    <th scope="col">Staff</th>
    <th scope="col">Date</th>
    <th scope="col">Receiver</th>
    <th scope="col">FeedBack</th>
    <th scope="col">FB Date</th>
  </tr>
  
 </tfoot>  
 <tbody>
  <?php foreach($this->list as $k => $v){
  			$nick = "";
  			if(!empty($v['receiver'])){
  				$nickTmp = $stDetail->getDetail($v['receiver']);
  				$nick = $nickTmp['ni'];
  			}else{
  				$nick = "";
  			}
  			?>
  <tr>
  		<td align="center"><?php echo $v['id_log']?></td>
  		<td align="center"><?php echo $v['type']?></td>
		<td align="center"><?php echo $v['sub_type']?></td>
		<td align="center"><?php echo $v['link']?></td>
		<td align="center"><?php echo $v['detail']?></td>
		<td align="center"><?php echo $v['staff_name']?></td>
		<td align="center"><?php echo $v['date_finish']?></td>
		<td align="center"><?php echo $nick?></td>
		<td align="center"><?php echo $v['feedback']?></td>
		<td align="center"><?php echo $v['feedback_date']?></td>
  </tr>
  <?php }?>
  </tbody>
  
</table>

<br />
</form>
</div>
   <script src="/js/chosen/chosen.jquery.js" type="text/javascript"></script>
  <script type="text/javascript"> 
    var config = {
      '.chzn-select': {allow_single_deselect:true},
    }
    for (var selector in config) {
      $(selector).chosen(config[selector]);
    }
  </script>
</body>
</html>
